﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Data;
using System.Data.SqlClient; 


namespace TKB.DataService
{
    // ConnectionStringlerin tutulma yerine, Db authentication yontemine gore degisebilir. 
    // Varsayilan => config file da connection string elemanında bulunan TKBIthalatDB key'i. 
    public class TKBDataObjectFactory
    { 
        private static string mDefaultConnectionString;

        static TKBDataObjectFactory()
        {
            mDefaultConnectionString = ConfigurationManager.ConnectionStrings["TKBIthalatDB"].ConnectionString;
        }
        public static ITKBDataObject GetDataObject(string pDefaultDB, bool pIsTransactional)
        {
            ITKBDataObject oDataObject = null;
            oDataObject = new TKBDataObject(mDefaultConnectionString, pDefaultDB , pIsTransactional);
            return oDataObject;
        }

        public static ITKBDataObject GetAnotherDataObject(string pConnectionStringName, string pDefaultDB, bool pIsTransactional)
        {
            string connectionString = ConfigurationManager.ConnectionStrings[pConnectionStringName].ConnectionString;
            ITKBDataObject oDataObject = null;
            oDataObject = new TKBDataObject(connectionString, pDefaultDB, pIsTransactional);
            return oDataObject;
        }

    }
}

